#ifndef __RECORD_H
#define __RECORD_H

#include <iostream>
#include <list>
#include <Book.h>
#include <Reader.h>

using namespace std;

/**
 * @brief 图书借阅记录
 *
 */
class Record
{
public:
    int book_id;
    int reader_id;
    Record(const Reader &, const Book &);
    Record(const int, const int);

    friend bool operator==(const Record &a, const Record &b);

    static list<Record> RecordList;
    static void borrow(const Reader &, const Book &);
    static void return_(const Reader &, const Book &);
    static string toJson();
    static list<Record> fromJson(string json_str);

    static void borrowBook();
    static void returnBook();

    static const char *file_name;
    static void saveFile();
    static void loadFromFile();
};

#endif